//
//  XHF_HostViewController.m
//  haojia
//
//  Created by 徐宏飞 on 16/4/22.
//  Copyright © 2016年 徐宏飞. All rights reserved.
//

#import "XHF_HostViewController.h"

#import "XHF_HostHeaderView.h"
#import "XHF_ModernTableView.h"
#import "XHF_EuclideanTableView.h"
#import "XHF_VintageTableView.h"

#import "XHF_HorizontalPagingView.h"



@interface XHF_HostViewController ()

@end

@implementation XHF_HostViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    XHF_HostHeaderView *headerView = [XHF_HostHeaderView headerView];
    
    //现代
    XHF_ModernTableView *modernTV = [XHF_ModernTableView modernTableView];
    
    //简欧
    XHF_EuclideanTableView *euclideanTV = [XHF_EuclideanTableView euclideanTableView];
    
    //复古
    XHF_VintageTableView *vintageTV = [XHF_VintageTableView vintageTableView];
    
    
    //buttons
    UIButton *modernBTN = [self createButtonWithNormalImg:@"btn_nor" SelectedImg:@"btn_hl" Title:@"现代"];
    UIButton *euclideanBTN =  [self createButtonWithNormalImg:@"btn_nor" SelectedImg:@"btn_hl" Title:@"简欧"];
    UIButton *vintageBTN = [self createButtonWithNormalImg:@"btn_nor" SelectedImg:@"btn_hl" Title:@"复古"];
    
    
    
    CGRect frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-156);
    //HorizontalPagingView
    XHF_HorizontalPagingView *pagingView = [XHF_HorizontalPagingView pagingViewWithHeaderView:headerView headerHeight:SCREEN_WIDTH*0.7  segmentButtons:@[modernBTN, euclideanBTN, vintageBTN] segmentHeight:40*WID contentViews:@[modernTV, euclideanTV, vintageTV] Frame:frame];
    
    
    pagingView.clickEventViewsBlock = ^(UIView *eventView) {
        
        NSLog(@"头部区域%ld", (long)eventView.tag);
        
    };
    
    [self.view addSubview:pagingView];
  
}


#pragma - 创建按钮
- (UIButton *)createButtonWithNormalImg:(NSString *)normalImg SelectedImg:(NSString *)selectedImg Title:(NSString *)title{
    
    UIButton *segmentButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [segmentButton setBackgroundImage:[UIImage imageNamed:normalImg] forState:UIControlStateNormal];
    [segmentButton setBackgroundImage:[UIImage imageNamed :selectedImg] forState:UIControlStateSelected];
    [segmentButton setTitle:title forState:UIControlStateNormal];
    [segmentButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    [segmentButton setTitleColor:COLOR_SELECTED forState:UIControlStateSelected];
    segmentButton.titleLabel.font = [UIFont systemFontOfSize:14];
    segmentButton.titleLabel.numberOfLines=2;
    segmentButton.titleLabel.textAlignment = NSTextAlignmentCenter;
    return segmentButton;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
